package com.yjt.fresh.adpater;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yjt.fresh.R;
import com.yjt.fresh.bean.BeanAddress;
import com.yjt.fresh.bean.BeanMessage;

import java.util.List;

/**
 * 我的地址
 * Created by mcc on 2018/6/10.
 */

public class AdpRvAtyAddresses extends BaseQuickAdapter<BeanAddress, BaseViewHolder> {
    public AdpRvAtyAddresses(int layoutResId, @Nullable List<BeanAddress> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanAddress item) {
        CheckBox cb = helper.getView(R.id.cbAppRecycleItemAtyAddress);
        TextView tvName = helper.getView(R.id.tvAppRecycleItemAtyAddressName);
        TextView tvPhone = helper.getView(R.id.tvAppRecycleItemAtyAddressPhone);
        TextView tvAlter = helper.getView(R.id.tvAppRecycleItemAtyAddressAlter);
        TextView tvDefault = helper.getView(R.id.tvAppRecycleItemAtyAddressDefault);
        TextView tvDetail = helper.getView(R.id.tvAppRecycleItemAtyAddressDetail);

        tvName.setText(item.getRECEIVER_NAME());
        tvPhone.setText(item.getRECEIVER_PHONE());
        if ("1".equals(item.getIS_DEFAULT())){
            tvDefault.setVisibility(View.VISIBLE);
        }else {
            tvDefault.setVisibility(View.GONE);
        }
        helper.addOnClickListener(R.id.cbAppRecycleItemAtyAddress);
        helper.addOnClickListener(R.id.tvAppRecycleItemAtyAddressAlter);
        tvDetail.setText(item.getPROVINCE()+item.getCITY()+item.getAREA()+item.getRECEIVER_ADDRESS());
    }
}
